package org.vehicle.iface;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.vehicle.entity.PassengerInfo;
import org.vehicle.service.PassengerInfoService;

@Controller
@RequestMapping("interface/passenger")
public class PassengerInfoController {
	private static Logger logger = LogManager.getLogger(PassengerInfoController.class.getName());
	@Autowired
	private PassengerInfoService passengerInfoService;

	// 客运站集合
	@RequestMapping("/getPassengerInfoList")
	@ResponseBody
	public Map<String, Object> getPassengerInfoList() {
		Map<String, Object> map = new HashMap<String, Object>();
		try{
			List<PassengerInfo> passengerInfoList = passengerInfoService.getPassengerInfoList();
			map.put("state", 1);
			map.put("msg", "客运站信息加载成功");
			map.put("KcPassengerinfolist", passengerInfoList);
		}catch(Exception e){
			logger.error(e);
			map.put("state", 0);
			map.put("msg", "客运站信息加载失败");
		}
		return map;
	}

}
